<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="#0A5AF9">
		<title>订单详情</title>
		<link rel="stylesheet" type="text/css" href="../css/public-head.css" />
		<link rel="stylesheet" type="text/css" href="../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/New_order-details.css"/>
</head>

<body>

	<div class="mui-content">
		<!-- 钥匙柜 -->
		<div class="con" id="conZhi">

			<!--<div>
					<div class="con-left">

						<div class="con-left-top">
							<div>
								<div><img src="../image/icon/yjdh@2x.png" alt="" /></div>
							</div>
							<div>
								<div>离我最近：<span>钥匙柜 QXWD-01</span></div>
								<div>0.28km |<img src="../image/icon/dingw@2x.png" alt="" />万达银座负二楼电梯口</div>
							</div>
						</div>
						<div class="con-left-bottom">
							<span>当前钥匙柜有12空位</span>
						</div>
					</div>
					<div class="con-right">
						<div><img src="../image/icon/ysg1@2x.png" alt="" /></div>

					</div>
				</div>-->
		</div>
		<!-- 门店列表 -->
		<div class="con" id="conZi">
			<!--<div>
					<div class="con-left">
						<div class="con-left-top">
							<div>
								<div><img src="../image/icon/yjdh@2x.png" alt="" /></div>
							</div>
							<div>
								<div><span>离我最近：</span>{{val.shop_name}}</div>
								<div>{{val.longitude}} |<img src="../image/icon/dingw@2x.png" alt="" />{{val.address}}</div>
							</div>
						</div>
						<div class="con-left-bottom-1">
							<span>2018-12-28<span><img src="../image/icon/sanjx1@2x.png" alt="" /></span></span>
							<span>空闲3<span>/共5个</span></span>
						</div>
					</div>
					<div class="con-right">
						<div><img src="../image/icon/mendian@2x.png" alt="" /></div>
					</div>
				</div>-->
		</div>
	</div>



</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/public-head.js"></script>
<script src="../script/template-web.js"></script>
<script type="text/javascript" src="../script/rem.js"></script>
<script type="text/javascript" src="../script/mui.js"></script>

<!-- 获取钥匙柜列表 -->
<script type="text/html" id="KeyCabinet1">
	{{each data as val}}
	<div onclick="fnGetDetail({{val}})">
		<div class="con-left">
			<div class="con-left-top">
				<div>
					<div><img src="../image/icon/yjdh@2x.png" alt="" /></div>
				</div>
				<div>
					<div>离我最近：<span id="imei_btn">钥匙柜{{val.imei}}</span></div>
					<div><img src="../image/icon/dingw@2x.png" alt="" />{{val.city}}{{val.area}}{{val.addr}}</div>
				</div>
			</div>
			<div class="con-left-bottom">
				<span>当前钥匙柜有空位</span>
			</div>
		</div>
		<div class="con-right">
			<div><img src="../image/icon/ysg1@2x.png" alt="" /></div>
		</div>
	</div>
	{{/each}}
</script>
<!-- 获取附近店铺列表 -->
<script type="text/html" id="KeyCabinet2">
	{{each data as val i}}
	<div onclick="fnGetDetail({{val}})">
		<div class="con-left">
			<div class="con-left-top">
				<div>
					<div><img src="../image/icon/yjdh@2x.png" alt="" /></div>
				</div>
				<div>
					<div><span>离我最近：</span>{{val.shop_name}}</div>
					<div><img src="../image/icon/dingw@2x.png" alt="" />{{val.address}}</div>
				</div>
			</div>
			<div class="con-left-bottom">
				<span>1人正在排队</span>
			</div>
		</div>
		<div class="con-right">
			<div><img src="../image/icon/mendian@2x.png" alt="" /></div>
		</div>
	</div>
	{{/each}}
</script>
<script type="text/javascript">
	apiready = function() {
		init();
		var type_list = api.pageParam.type_list;
		console.log(type_list);
		if (type_list == "key") {
			// 获取钥匙柜列表
			fnKeyCabinet();
		} else if(type_list == "shops") {
			// 获取门店列表
			fnStoreList();
		}
	};

	headInner({
			title: "服务列表",
			//headleft
			headl: '<a  style="color:white" class="mui-icon mui-icon-left-nav" tapmode onclick="api.closeFrame()"></a>',
			//headright
			headr: '<div class="tu_2"></div>',
			color: "", //默认是蓝色
			padding: "0px 0px 0px",
		})
		// 获取点击信息
	function fnGetDetail(item) {
		if (item.shop_id) {
			//钥匙柜信息
			console.log("钥匙");
			item.ser_type = 1;
			// console.log(JSON.stringify(item))
		} else {
			// 门店信息
			item.ser_type = 2;
			console.log("mendian");
		}
		// 存全局变量
		$api.setStorage('item_infor', item);
		// 远程调用方法
		api.execScript({
			name: 'order-details_1',
			script: 'fnGetCallBackData();'
		});
		api.closeWin();
	}

	//获取空闲钥匙柜列表
	function fnKeyCabinet() {
		console.log("获取钥匙柜");
		BASE.MYajax({
			'pathName': 'keycabinet/index',
			'method': KeyCabinet //调用函数
		});
	}
	function KeyCabinet(ret, err) {
		if (ret.code == 200) {
			// console.log("获取钥匙柜111" + JSON.stringify(ret));
			var key_html = template('KeyCabinet1', ret);
			document.getElementById('conZhi').innerHTML = key_html;
		} else {
			reToast(ret, err)
		}
	}

	//获取附近店铺列表
	function fnStoreList() {
		// console.log("获取店铺列表");
		BASE.MYajax({
			'pathName': 'home/getShops',
			'method': GetAList //调用函数
		});
	}
	function GetAList(ret, err) {
		if (ret.code == 200) {
			// console.log("获取店铺店铺呦111" + JSON.stringify(ret));
			var shop_html = template('KeyCabinet2', ret);
			document.getElementById('conZi').innerHTML = shop_html;
		} else {
			reToast(ret, err)
		}
	}
</script>

</html>
